<?php
namespace app\shop\route;
use app\shop\validate\company\Department;
use app\shop\validate\company\Staff;
use app\shop\validate\company\Station;
use app\shop\validate\company\Study;
use app\shop\validate\company\Team;
use app\shop\validate\company\Examine;
use app\shop\validate\company\Interview;
use think\facade\Route;
use app\shop\middleware\Auth;
Route::get('company', 'company.Company/index')->allowCrossDomain();
Route::post('company', 'company.Company/save')->allowCrossDomain();

Route::group("department", function () {
    Route::get('list', 'company.Department/index');        //部门列表
    Route::get('options', 'company.Department/options');
    Route::post('add', 'company.Department/add')->validate(Department::class, 'add');        //新增部门
    Route::put('edit', 'company.Department/edit')->validate(Department::class, 'edit');       //编辑部门
    Route::delete(':id', 'company.Department/delete')->validate(Department::class, 'del');    //删除部门
    Route::get(':id', 'company.Department/form')->validate(Department::class, 'del');    //部门信息表单
})->allowCrossDomain();

Route::group("staff", function () {         //员工管理
    Route::group("file", function () {
        Route::post('save', 'company.Staff/saveFile')->validate(Staff::class, 'saveFile');        //列表
        Route::get('type', 'company.Staff/fileTypes');
        Route::delete(':id', 'company.Staff/delFile');    //删除
    });
    Route::get('list', 'company.Staff/list');        //列表
    Route::get('options', 'company.Staff/options');        //列表
    Route::post('save', 'company.Staff/save')->validate(Staff::class, 'save');        //编辑员工
    Route::post('leave', 'company.Staff/leave')->validate(Staff::class, 'leave');
    Route::get('files/:user_id', 'company.Staff/files');        //列表
    Route::get('leave/:user_id', 'company.Staff/leaveInfo');        //列表
    Route::delete(':user_id', 'company.Staff/delete')->validate(Staff::class, 'info');    //删除
    Route::get(':user_id', 'company.Staff/form')->validate(Staff::class, 'info');    //信息表单
})->allowCrossDomain()->middleware([Auth::class]);

Route::group("team", function () {         //团队风采
    Route::group("class", function () {
        Route::get('list', 'company.Team/classList');        //列表
        Route::post('add', 'company.Team/addClass')->validate(Team::class, 'addClass');        //编辑员工
        Route::put('edit', 'company.Team/editClass')->validate(Team::class, 'editClass');        //编辑员工
        Route::delete(':id', 'company.Team/deleteClass')->validate(Team::class, 'info');    //删除
        Route::get(':id', 'company.Team/classForm')->validate(Team::class, 'info');    //信息表单
    });
    Route::get('list', 'company.Team/list');        //列表
    Route::post('add', 'company.Team/add')->validate(Team::class, 'add');        //编辑员工
    Route::put('edit', 'company.Team/edit')->validate(Team::class, 'edit');        //编辑员工
    Route::delete(':id', 'company.Team/delete')->validate(Team::class, 'info');    //删除
    Route::get(':id', 'company.Team/info')->validate(Team::class, 'info');    //信息表单
})->allowCrossDomain()->middleware([Auth::class]);

Route::group("station", function () {         //员工管理
    Route::get('list', 'company.station/list');        //列表
    Route::post('save', 'company.station/save')->validate(station::class, 'save');        //编辑员工
    Route::delete(':id', 'company.station/delete')->validate(station::class, 'info');    //删除
})->allowCrossDomain()->middleware([Auth::class]);

Route::group("interview", function () {         //面试管理
    Route::get('list', 'company.Interview/list');        //列表
    Route::get('log/:view_id', 'company.Interview/logs');        //面试记录
    Route::get('form/:id', 'company.Interview/form')->validate(Interview::class, 'info');        //列表
    Route::post('save', 'company.Interview/save')->validate(Interview::class, 'save');        //编辑员工
    Route::delete(':id', 'company.Interview/delete')->validate(Interview::class, 'info');    //删除
})->allowCrossDomain()->middleware([Auth::class]);

Route::group("train", function () {         //培训管理
    Route::get('student', 'company.Train/student');        //列表
    Route::post('addStudent', 'company.Train/addStudent');        //编辑员工
    Route::get('trainStation', 'company.Train/trainStation');
    Route::get('trainLog', 'company.Train/trainLog');
    Route::post('doneTrain/:user_id', 'company.Train/doneTrain');
    Route::post('saveFile', 'company.Train/saveFile');
    Route::get('files', 'company.Train/files');
    Route::delete('file/:id', 'company.Train/delFile');
})->allowCrossDomain()->middleware([Auth::class]);

Route::group("examine", function () {         //团队风采
    Route::group("staff", function () {
        Route::get('list', 'company.Examine/staffList');        //列表
        Route::get('logs', 'company.Examine/staffLogs');        //列表
        Route::post('add', 'company.Examine/staffAdd')->validate(Examine::class, 'staffAdd');        //编辑员工
        Route::put('edit', 'company.Examine/staffEdit')->validate(Examine::class, 'staffEdit');        //编辑员工
        Route::delete(':id', 'company.Examine/delete')->validate(Examine::class, 'info');    //删除
    });
    Route::get('list', 'company.Examine/list');        //列表
    Route::post('add', 'company.Examine/add')->validate(Examine::class, 'add');        //编辑员工
    Route::put('edit', 'company.Examine/edit')->validate(Examine::class, 'edit');        //编辑员工
    Route::get('reports', 'company.Examine/reports');        //列表
    Route::get('report/:id', 'company.Examine/reportInfo');        //列表
    Route::delete(':id', 'company.Examine/delete')->validate(Examine::class, 'info');    //删除
    Route::get(':id', 'company.Examine/info')->validate(Examine::class, 'info');    //信息表单
})->allowCrossDomain()->middleware([Auth::class]);

Route::group("study", function () {         //员工管理
    Route::group("video", function () {
        Route::get('list', 'company.Study/videoList');        //列表
        Route::post('add', 'company.Study/videoAdd')->validate(Study::class, 'add');        //编辑员工
        Route::put('edit', 'company.Study/videoEdit')->validate(Study::class, 'edit');        //编辑员工
        Route::get(':id', 'company.Study/videoInfo')->validate(Study::class, 'info');        //列表
        Route::delete(':id', 'company.Study/videoDel')->validate(Study::class, 'info');    //删除
    });
    Route::get('list', 'company.Study/list');        //列表
    Route::get(':id', 'company.Study/info');        //编辑员工
    Route::post('check', 'company.Study/check');    //审核
})->allowCrossDomain()->middleware([Auth::class]);

Route::group("company_file",function(){
    Route::get('list', 'company.File/list');
    Route::post('save', 'company.File/save');
    Route::delete(':id', 'company.File/delete');
})->allowCrossDomain()->middleware([Auth::class]);